package adapter.service.impl;

import adapter.service.advanceMediaPlayer;
import adapter.service.mediaPlayer;

public class adapter implements mediaPlayer {
    advanceMediaPlayer advanceMediaPlayer;
    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("vlc")){
            advanceMediaPlayer.playVlc(fileName);
        }else if (audioType.equalsIgnoreCase("mp4")){
            advanceMediaPlayer.playMp4(fileName);
        }
    }

    //自定义适配
    public adapter(String audioType){
        if (audioType.equalsIgnoreCase("vlc")){
            advanceMediaPlayer = new vlcPlayerImpl();  //接口可以等于实现类
        }else if (audioType.equalsIgnoreCase("mp4")){
            advanceMediaPlayer = new mp4PlayerImpl();
        }
    }

}
